package managers;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

import utils.StackTracePrinter;

public class FastProperties extends Properties {

	private String optionsPath;

	public FastProperties(String optionsPath) {
		super();
		this.optionsPath = optionsPath;
	}

	public synchronized void load() throws FileNotFoundException, IOException {
		super.load(new FileReader(optionsPath));
	}


	public void store() {
		try {
			super.store(new FileWriter(optionsPath), "OPTIONS SET. DO NOT MANUALLY MODIFY.");
		} catch (IOException e) {
			System.err.println("Options not stored in "+optionsPath);
			StackTracePrinter.print(e);
		}
	}
}